package com.ansion.basedb.database.sql;

import androidx.annotation.NonNull;

import com.ansion.basetool.preconditions.Preconditions;

/**
 * created by zhaoyuntao
 * on 27/11/2023
 */
public class BaseSearchParams<P> {
    private String searchContent;
    private int limit;
    private int pageNumber;

    @SuppressWarnings("unchecked")
    public P setLimit(int limit) {
        Preconditions.checkArgument(limit > 0, "SearchParams.setLimit error:" + limit);
        this.limit = limit;
        return (P) this;
    }

    @SuppressWarnings("unchecked")
    public P setPageNumber(int pageNumber) {
        Preconditions.checkArgument(pageNumber >= 0, "SearchParams.setPageNumber error:" + pageNumber);
        this.pageNumber = pageNumber;
        return (P) this;
    }

    @SuppressWarnings("unchecked")
    public P setSearchContent(@NonNull String searchContent) {
        this.searchContent = searchContent;
        return (P) this;
    }

    public int getLimit() {
        return limit;
    }

    public int getPageNumber() {
        return pageNumber;
    }

    public String getSearchContent() {
        return searchContent;
    }
}
